﻿namespace Toggl.PhoneClient.Domain
{
    using System;
    using Newtonsoft.Json;
    using Newtonsoft.Json.Converters;

    [JsonObject]
    public class Task
    {
        [JsonProperty(PropertyName = "id", NullValueHandling = NullValueHandling.Ignore)]
        public int? Id { get; set; }

        [JsonProperty(PropertyName = "description", NullValueHandling = NullValueHandling.Ignore)]
        public string Description { get; set; }

        [JsonProperty(PropertyName = "start")]
        [JsonConverter(typeof(IsoDateTimeConverter))]
        public DateTime StartedOn { get; set; }

        [JsonProperty(PropertyName = "stop", NullValueHandling = NullValueHandling.Ignore)]
        [JsonConverter(typeof(IsoDateTimeConverter))]
        public DateTime StopedOn { get; set; }

        [JsonProperty(PropertyName = "billable")]
        public bool Billable { get; set; }

        [JsonProperty(PropertyName = "duration")]
        public int Duration { get; set; }

        [JsonProperty(PropertyName = "workspace", NullValueHandling = NullValueHandling.Ignore)]
        public Workspace Workspace { get; set; }

        [JsonProperty(PropertyName = "project", NullValueHandling = NullValueHandling.Ignore)]
        public Project Project { get; set; }

        [JsonIgnore]
        public PlannedTask PlannedTask { get; set; }

        [JsonProperty(PropertyName = "tag_names", NullValueHandling = NullValueHandling.Ignore)]
        public string[] TagNames { get; set; }

        [JsonProperty(PropertyName = "created_with", NullValueHandling = NullValueHandling.Ignore)]
        public string CreatedWith { get; set; }
    }
}
